package cs236369.webserver.test;


import java.io.File;

import org.junit.Before;
import org.junit.Test;

public class parent {

	@Before
	public void setUp() throws Exception {
	}
	
	@Test
	public void parentCheck(){
		File requestFile = new File("\\Temp\\1\\2\\3\\3.txt");
		File tmpFile = requestFile;
		File serverDir = new File("\\Downloads");
		while(!tmpFile.equals(serverDir)){
			tmpFile = tmpFile.getParentFile();
		}
		if (requestFile.isDirectory()){
			System.out.println("directory");
		}
		if (!requestFile.isFile()){
			System.out.println("file");
		}
		if (!requestFile.canRead()){
			//TODO report an error to client
			System.out.println("can not read");
		}
	}

}
